import fetch from 'common/src/utils/fetch'

function getRetrainingInfo(data) {
    return fetch({
        url: '/api/arrangementservice/retraining/getRetrainingInfo',
        method: 'post',
        data: data
    });
}
/**
 * 修改课程的开课转态
 */
function updateCourseOpenStatus(data) {
    return fetch({
        url: '/api/arrangementservice/retraining/updateCourseOpenStatus',
        method: 'post',
        data: data
    });
}

/**
 * 刪除课程的开课状态
 */
function deleteCourseOpenStatus(data) {
    return fetch({
        url: '/api/arrangementservice/retraining/delete',
        method: 'post',
        data: data
    });
}

/**
 * 导出
 */
function exportRetrainingInfo(data) {
    return fetch({
        url: '/api/scoremanagementservice/retraining/export',
        method: 'post',
        data: data
    });
}

/**
 * 导出不及格学生信息
 */
function exportFailStu(data) {
    return fetch({
        url: '/api/scoremanagementservice/retraining/exportFailStu',
        method: 'post',
        data: data
    });
}

/**
 * 导出不及格学生信息
 */
function getResult(key) {
    return fetch({
        url: '/api/scoremanagementservice/retraining/result/' + key,
        method: 'get',
    });
}

/**
 * 分页查询不及格学生信息
 */
function getFailStudentInfo(form) {
    return fetch({
        url: '/api/scoremanagementservice/failedStudentController/queryFailedStudentInfo?courseCode=' + form.condition.courseCode 
        + '&calendarId=' + form.condition.calendarId +'&campus=' + form.condition.campus +'&nation=' + form.condition.nation + '&pageSize_='+ form.pageSize_ + '&pageNum_=' + form.pageNum_,
        method: 'get',
    });
}

/**
 * 获取重修课程
 */
function findRetrainingCourse(calendarId, insertCalendar) {
    return fetch({
        url:
            '/api/arrangementservice/retraining/findRetrainingCourse?calendarId=' +
            calendarId +
            '&insertCalendar=' +
            insertCalendar,
        method: 'get'
    });
}

export default {
    getRetrainingInfo: getRetrainingInfo,
    updateCourseOpenStatus: updateCourseOpenStatus,
    exportRetrainingInfo: exportRetrainingInfo,
    getFailStudentInfo: getFailStudentInfo,
    findRetrainingCourse: findRetrainingCourse,
    exportFailStu: exportFailStu,
    getResult: getResult,
    deleteCourseOpenStatus:deleteCourseOpenStatus,
};
